#ifndef BEHAVIORCOHESION_H
#define BEHAVIORCOHESION_H

#include "Behavior.h"

/**
 * Class BehaviorCohesion
 *
 * This class is used for the cohesion behaviour
 */
class BehaviorCohesion : public Behavior
{
protected:
	/// Range of detection.
	float mMinRadius;
	float mMaxRadius;
	float mCosMaxAngle;

public:
	/// Default constructor
	BehaviorCohesion() :
		Behavior(BEHAVIOR_COHESION),
		mMinRadius(0.0f), mMaxRadius(0.0f), mCosMaxAngle(0.0f)
	{}

	/// Default destructor
	~BehaviorCohesion();

	/**
	 * Set the detection range for flocking (if max radius is 0 or less, we skip detection)
		\param minRadius The minimal Radius
		\param maxRadius The maximal Radius
		\param maxAngle The maximal Angle
	 */
	void setDetectionRange(float minRadius, float maxRadius, float maxAngle)
	{
		mMinRadius = minRadius;
		mMaxRadius = maxRadius;
		mCosMaxAngle = Ogre::Math::Cos(maxAngle);
	}

	/// Executes the behavior
	Ogre::Vector3 execute(const BoidBase* boid);
};

#endif // BEHAVIORCOHESION_H
